<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserOfficialInfosTable extends Migration
{
    /**
     * 用户公众号相关信息
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_official_infos', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('user_id');
            $table->string('remark')->nullable()
                ->comment('公众号运营者对粉丝的备注，公众号运营者可在微信公众平台用户管理界面对粉丝添加备注');
            $table->string('subscribe')->default(0)
                ->comment('用户是否订阅该公众号标识，值为0时，代表此用户没有关注该公众号，拉取不到其余信息');
            $table->bigInteger('subscribe_time')->nullable()
                ->comment('用户关注时间，为时间戳。如果用户曾多次关注，则取最后关注时间');
            $table->string('subscribe_scene')->nullable()
                ->comment('返回用户关注的渠道来源，ADD_SCENE_SEARCH 公众号搜索，
                ADD_SCENE_ACCOUNT_MIGRATION 公众号迁移，ADD_SCENE_PROFILE_CARD 名片分享，
                ADD_SCENE_QR_CODE 扫描二维码，ADD_SCENE_PROFILE_ LINK 图文页内名称点击，
                ADD_SCENE_PROFILE_ITEM 图文页右上角菜单，ADD_SCENE_PAID 支付后关注，ADD_SCENE_OTHERS 其他');
            $table->string('qr_scene')->nullable()->comment('二维码扫码场景');
            $table->string('qr_scene_str')->nullable()->comment('二维码扫码场景描述');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_official_infos');
    }
}
